home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / tm480 / tmexam.exe / WHEREIS.TSK < prev    next >
Text File  |  1991-09-10  |  3KB  |  131 lines

  1. ; Title   : WHEREIS.TSK                 Last Updated : June 17, 1991
  2. ; Author  : Steve Johnson - FmP.        Version      : 1.00
  3. ; Purpose : Helps locate datafiles based on APPEND 
  4. ; Notes   : Uses Environment variable and shows how SCAN can
  5. ;         : be used to extract parts of a string.
  6.  
  7. hexvar esc,1b
  8. var applist,100,$append
  9. var target_dir,30
  10. var target,40
  11. var filename,12,' WHEREIS'    ;default only used if no forms
  12. int count
  13. logical continue
  14. logical forever
  15. var null,1
  16. vconst cls,11
  17. vconst nor,71
  18. vconst attn,79
  19. vconst bright,41
  20. var wdir,64
  21.  
  22. end
  23.  
  24. forms logon.ovr
  25. dir whereis.ovr 
  26. if not found
  27.   insert filename filename 
  28.   put "NO_FORMS"
  29.   stop
  30. fi
  31. forms whereis.ovr
  32. move 'WORDPROC.TM' to filename
  33. user wdir
  34. until forever
  35.   fieldfill filename
  36.   put problem noclear
  37.   if anyfk
  38.     stop
  39.   fi
  40.   get filename
  41.   upper filename
  42.   trim filename 
  43.   if applist = null
  44.     put 'NOT_ENVIRONMENTALLY_FRIENDLY' noclear
  45.     stop
  46.   else
  47.     display NOR bright cls 
  48.     displayln 'Your working directory is: ' wdir
  49.     dir filename
  50.     if found
  51.       display NOR 27 ATTN wdir '\' filename ' exists' NOR
  52.     else
  53.       display 27 '(' wdir '\' filename ' NOT present)'
  54.     fi    
  55.     displayln 1
  56.     displayln "Your APPEND environment variable contains:"
  57.     display ATTN applist NOR
  58.     displayln 1
  59.     displayln 1
  60.   fi
  61.   replace all '\\' of applist with '\'
  62.   setscan applist
  63.   move ';' to delim
  64.   move true to continue 
  65.   clear count
  66.   until not continue
  67.     clear target_dir
  68.     scan target_dir
  69.     move found to continue
  70.     if found
  71.       displayln 'Element ' count ' of APPEND is ' target_dir
  72.       combine target_dir '\' filename into target
  73.       replace all '\\' of target with '\'
  74.       dir target
  75.       if found
  76.         display NOR 27 ATTN target ' exists' NOR
  77.       else
  78.         display 27 '(' target ' NOT present)'
  79.       fi
  80.       DISPLAYLN 1
  81.     fi
  82.   fi count
  83.   wait 'Press any key to continue or <esc> to quit'
  84.   if keyval = esc
  85.     stop
  86.   fi
  87. fi
  88. stop
  89. endtask
  90. @video
  91. @head left,WHEREIS.TSK
  92. @head right,'Taskmaster (C) FmP 1991'
  93. @head centre,'Environmentally Friendly'
  94. @nf problem
  95. @acceptfk f10
  96. @str
  97. @bright
  98. @colour char,white,red
  99. @banner
  100. @colour page,white,green
  101.  
  102.      The  APPEND  command  enables programs to find  datafiles  which  are   
  103.      located in directories other than the working directory.  
  104.  
  105.      Generally this is a good thing;  if however you need to know  exactly 
  106.      which version of a file the operating system is finding this task can 
  107.      help.
  108.  
  109.      The  task  works by looking at the APPEND  environment  variable  one 
  110.      element  at a time and checking if the file you are interested in  is 
  111.      located there.
  112.  
  113.      Which file are you interested in? [WORDPROC.TM ] You may use ? and *
  114. @col char,white,red
  115.  
  116.                 Press F10 to quit
  117. @end  
  118. @nf not_environmentally_friendly
  119. @col char,white,red
  120. @win line15,column10,depth7,width60,pattern 177
  121. @bright
  122. @win line16,column15,depth5,width50
  123.      You don't have APPEND in your environment!
  124.  
  125.      You may add it by including the line:
  126.      APPEND /e 
  127.      as the 1st APPEND command in AUTOEXEC.BAT
  128. @end
  129. @eof
  130. 
  131.